home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 13 / AMIGAplus Sonderheft 13 (1998)(ICP)(DE)[!].iso / rexx / rect_to_polar.scrx < prev    next >
Text File  |  1997-11-01  |  723b  |  39 lines

  1. /*        SciCalc Scientific Calculator
  2.         by Brian Savage copyright 1997
  3.  
  4.         Arexx script to convert cartesian coordinates to polar
  5.         coordinates.
  6.  
  7.         This script requires RexxMathLib.library
  8.  
  9. */
  10.  
  11. if ~show("l", "rexxmathlib.library") then
  12.     if ~addlib("rexxmathlib.library", 0, -30,0) then
  13.     do
  14.       address command
  15.       say  "Can't find RexxMathLib"
  16.     end
  17.  
  18.  
  19. options results
  20.  
  21. getreg 1                /*   y -> from register #1                 */
  22.  
  23. parse var result y
  24.  
  25. getval                  /*   x -> displayed value                  */
  26.  
  27. parse var result x
  28.  
  29. putval sqrt(x**2+y**2)    /* radius r -> displayed value           */
  30.  
  31. putreg 1 atan(y/x)        /* angle theta (radians) -> returned
  32.                              in register 1                            */
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.